package org.lan.web.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class UserController {

	@RequestMapping("/login")
	public String login(String username, String password) {
		Subject subject = SecurityUtils.getSubject();
		subject.login(new UsernamePasswordToken(username, password));
		return null;
	}

	@RequestMapping("/home")
	public String index() {
		return "home";
	}

	@RequestMapping("/toLogin")
	public String toLogin() {
		return "login";
	}
}
